package com.timmy.cloud_pc_test;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.util.AttributeSet;
import android.view.View;

import androidx.annotation.Nullable;

public class CustomRockerView extends View {

    private static final double A = 180.0D;

    private static final double B = 0.0D;

    private static final double C = 90.0D;

    private static final double D = 180.0D;

    private static final double E = 270.0D;

    private static final double F = 45.0D;

    private static final double G = 135.0D;

    private static final double H = 225.0D;

    private static final double I = 315.0D;

    private static final double J = 15.0D;

    private static final double K = 75.0D;

    private static final double L = 105.0D;

    private static final double M = 165.0D;

    private static final double N = 195.0D;

    private static final double O = 255.0D;

    private static final double P = 285.0D;

    private static final double Q = 345.0D;

    private static final int R = 0;

    private static final int S = 1;

    private static final int T = 2;

    private static final int U = 3;

    public static final int a = 100;

    private static final int al = 4;

    private static final int am = 5;

    private static final int an = 6;

    private static final int ao = 7;

    private static final int au = 30;

    public static final int b = 101;

    public static final int c = 102;

    public static final int d = 103;

    public static final int e = 104;

    private static final String f = "CustomRockerView";

    private static final int g = 400;

    private static final int h = 50;

    private static final double v = 0.0D;

    private static final double w = 360.0D;

    private static final double x = 90.0D;

    private static final double y = 270.0D;

    private static final double z = 0.0D;

    private int V = 3;

    private Bitmap W;

    private boolean aA = false;

    private int aB;

    private float aC;

    private float aD;

    private boolean aE = false;

    private float aF = 0.0F;

    private int aG;

    private BitmapFactory.Options aH;

    private Bitmap aa;

    private Bitmap ab;

    private Bitmap ac;

    private Bitmap ad;

    private Bitmap ae;

    private Bitmap af;

    private Bitmap ag;

    private Bitmap ah;

    private Bitmap ai;

    private Bitmap aj;

    private int ak;

    private int ap = 7;

    private Bitmap aq;

    private int ar;

    private int as;

    private int at;

    private Handler av;

    private Runnable aw;

    private Runnable ax;

    private Runnable ay;

    private Runnable az;

    private Paint i;

    private Paint j;

    private Point k;

    private Point l;

    private int m;

    private int n;

    private EnumA o = EnumA.b;

    private d p;

    private f q;

    private e r;

    private EnumC s;

    private EnumB t = EnumB.i;

    private g u;


    public CustomRockerView(Context paramContext, @Nullable AttributeSet paramAttributeSet) {
        super(paramContext, paramAttributeSet);
        a(paramContext, paramAttributeSet);
//        b();

        this.i = new Paint();
        this.i.setAntiAlias(true);

        this.j = new Paint();
        this.j.setAntiAlias(true);

        this.l = new Point();
        this.k = new Point();
        this.av = new Handler();
    }


    private double a(double paramDouble) {
        paramDouble = Math.round(paramDouble / Math.PI * 180.0D);
        if (paramDouble < 0.0D)
            paramDouble += 360.0D;
        return paramDouble;
    }

    private Bitmap a(Drawable paramDrawable) {
        Bitmap.Config config;
        int i = paramDrawable.getIntrinsicWidth();
        int j = paramDrawable.getIntrinsicHeight();

        if (paramDrawable.getOpacity() != PixelFormat.OPAQUE) {
            config = Bitmap.Config.ARGB_8888;
        } else {
            config = Bitmap.Config.RGB_565;
        }
        Bitmap bitmap = Bitmap.createBitmap(i, j, config);
        Canvas canvas = new Canvas(bitmap);
        paramDrawable.setBounds(0, 0, i, j);
        paramDrawable.draw(canvas);
        return bitmap;
    }

    private Point a(Point paramPoint1, Point paramPoint2, float paramFloat1, float paramFloat2) {
        float f1 = (paramPoint2.x - paramPoint1.x);
        float f2 = (paramPoint2.y - paramPoint1.y);
        f2 = (float) Math.sqrt((f1 * f1 + f2 * f2));
        double d1 = Math.acos((f1 / f2));

        int i = paramPoint2.y < paramPoint1.y ? -1 : 1;

        double d2 = d1 * i;
        d1 = a(d2);

        this.aD = (float) (Math.cos(d2) * 15.0D);
        this.aC = (float) (Math.sin(d2) * 15.0D);

        if (f2 + paramFloat2 - this.aF <= paramFloat1) {
//            a(d1, this.aD, this.aC, false);
            return paramPoint2;
        }

        double d3 = paramPoint1.x;
        paramFloat1 -= paramFloat2;
        int i1 = (int) (d3 + (this.aF + paramFloat1) * Math.cos(d2));
        int j = (int) (paramPoint1.y + (paramFloat1 + this.aF) * Math.sin(d2));
//        a(d1, this.aD, this.aC, true);
        return new Point(i1, j);
    }

    private void a(Context paramContext, AttributeSet paramAttributeSet) {

    }

    public enum EnumA {
        a, b;
    }

    public enum EnumB {
        a, b, c, d, e, f, g, h, i;
    }

    public enum EnumC {
        a, b, c, d, e;
    }


    public static interface d {
        void a();

        void a(double param1Double);
    }

    public static interface e {
        void a(float param1Float1, float param1Float2);

        void f();
    }

    public static interface f {
        void a(EnumB param1b1, EnumB param1b2, CustomRockerView.g param1g);

        void a(EnumB param1b, CustomRockerView.g param1g);
    }

    public enum g {
        a, b;
    }
}
